package cn.auction.biz.impl;

import cn.auction.biz.IuseBiz;
import cn.auction.dao.Iuser;
import cn.auction.dao.impl.IuseImpl;
import cn.auction.entity.AuctionUser;
import my.framework.dao.DatabaseUtil;

import java.sql.SQLException;

public class IuserBizImpl implements IuseBiz {
    Iuser iuser=new IuseImpl();
    @Override
    public void insert(AuctionUser auctionUser) throws SQLException {//注册
        try {
            iuser.insert(auctionUser);
            DatabaseUtil.getConnection().commit();
        } catch (Exception throwables) {
            DatabaseUtil.getConnection().rollback();
            throwables.printStackTrace();
        }finally {
            DatabaseUtil.closeConnection();
        }
    }

    @Override
    public AuctionUser UserLogin(String userName, String userPassWord,boolean isAdmin) throws SQLException {
        try {
            return iuser.UserLogin(userName,userPassWord,isAdmin);
        }finally {
            DatabaseUtil.closeConnection();
        }
    }
    
}
